<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		  <title>mongodb web版查询功能</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="../../static/css/font.css">
		<link rel="stylesheet" href="../../static/css/weadmin.css">
		<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
		<!--[if lt IE 9]>
	      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
	      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
	    <![endif]-->
	    <style type="text/css">
		   .dblist ul {list-style-type: none;margin:0; padding:0;}
		   .dblist ul li {float:left;width: 350px;margin-left: 30px;margin-top: 30px;}
	    </style>
	</head>

	<body>
		<div class="weadmin-nav">
			<span class="layui-breadcrumb">
		        <a href="#">首页</a>
		        <a href="#">数据表管理</a>
		        <a><cite>数据表列表</cite></a>
	      </span>
			<a class="layui-btn layui-btn-sm" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
				<i class="layui-icon layui-icon-refresh" style="font-size: 30px;line-height: 30px;"></i>  
			</a>
		</div>

		<div class="weadmin-body">
	
			<div class="layui-row">
				
					搜索：
					<div class="layui-inline">
						<input type="text" name="username" placeholder="请输入表名称" autocomplete="off" class="layui-input">
					</div>
					<button class="layui-btn"  onclick="sreach()"><i class="layui-icon">&#xe615;</i></button>
			
			</div>
			<div class="layui-anim layui-anim-up"></div>
			
			<div class="dblist">
				<ul id="list">
					
				</ul>					      
			</div>
		</div>
		<!--<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>-->
		<script src="../../lib/layui/layui.js" charset="utf-8"></script>
		<script type="text/javascript">
		layui.extend({
			admin: '{/}../../static/js/admin'
		});
		layui.use(['jquery', 'admin'], function() {
			var $ = layui.jquery,admin = layui.admin;
			 $(function () {
				 var obj=urlToJSON();
				  $("#list").html('');
			        var dbName=obj.dbName;  

			        $.ajax({
			            url: baseURl+"/mongo/db",
			            dataType: "json",
			            type: "post",
			            async: false,
			            data: {"dbName":dbName},
			            success: function (data) {

			                if (data.code == 0) {
			                    $.each(data.listNames, function (index, obj) {
			                    	var html='<li data-name="'+obj.tableName+'" ><a href="javascript:;"><i class="layui-icon layui-icon-template-1" style="font-size: 30px; color: #e68060;"></i>';
			                    		html+='<span style="margin-left: 10px;font-size: 20px;">'+obj.tableName+'</span><span style="margin-left: 10px;font-size: 10px;">'+obj.size+'</span></span></a></li>';
			                        $("#list").append(html)
			                    })
			                }else{
                                layer.msg(data.msg, {icon: 2, time: 2000}, function(){});

                            }
			            }
			        });
			        
			        $(document).on('click','#list li',function() {	
						var tableName=$(this).attr("data-name");
						WeAdminEdit(tableName+'集合数据列表','./collections.html?tableName='+tableName+'&dbName='+dbName, '', 1200, 600);
					});
			    })
			

				//搜索
				window.sreach = function (argument){
				 	layer.msg('开发中....', {icon: 1, time: 1000}, function(){}); 
				}
		});
		</script>
	</body>

</html>